// import json from './repositoryCoords.json'
const json = require('./repositoryCoords.json')
console.log('🚀 ~ json:', json)

const { minX, minY, minZ, maxX, maxY, maxZ } = json.reduce(
    (acc, cur) => {
        const { longitude: x, latitude: y, height: z } = cur
        acc.minX = Math.min(acc.minX, x)
        acc.minY = Math.min(acc.minY, y)
        acc.minZ = Math.min(acc.minZ, z)
        acc.maxX = Math.max(acc.maxX, x)
        acc.maxY = Math.max(acc.maxY, y)
        acc.maxZ = Math.max(acc.maxZ, z)
        return acc
    },
    {
        minX: Infinity,
        minY: Infinity,
        minZ: Infinity,
        maxX: -Infinity,
        maxY: -Infinity,
        maxZ: -Infinity,
    }
)
// console.log(
//     '🚀 ~  minX, minY, minZ, maxX, maxY, maxZ :',
//     minX,
//     minY,
//     minZ,
//     maxX,
//     maxY,
//     maxZ
// )

console.log(rToD(minX), rToD(minY), rToD(maxX), rToD(maxY))

function rToD(r) {
    return (r * 180) / Math.PI
}

// 经度 [115.5,116.5]
// 纬度 [39.5,40.5]